<template>
  <div class="page">
     <!-- 顶部导航栏 -->
     <header class="header">
       <div class="headerDiv" >
        <div class="logo-wrapper">
          <img  :src="shopInfo.image" alt="" class="logo">
          <div>
          <div>
            <span class="company-name">{{ shopInfo.company_title }}</span>
            <span class="strengthIcon" > <img v-if="shopInfo.if_strength" src="../../../static/engineering5188/homPage/strength.png" alt="" ></span>
            <span class="zhtyText" >综合体验： </span>
            <span class="rating">
              <van-rate v-model="shopInfo.star" color="#ffd21e" disabled-color="#ffd21e" disabled />
            </span>
          </div>
          <div class="dizhiDiv"  @click="openMap(shopInfo.reg_address)">
            <span class="dizhi"><img class="weizhiIcon" src="../../../static/engineering5188/homPage/orientation.png" alt="" />
              公司地址：<span style="color: #222222;">{{ shopInfo.reg_address }}</span>
              <span class="lookDt">查看地图</span></span>

          </div>
          </div>
        </div>
      
       
        <div class="search-wrapper">
          <input type="text" v-model="keyword" placeholder="请输入要搜索的商品" class="search-input"></input>
          <button class="search-button" @click="jumpSearch">搜索</button>
        </div>
       </div>

      </header>

     <div class="navHeard" >

        <nav class="nav" >
          <ul>
            <li  :class="indexType == 1 ? 'liTab' : 'liTabHoure'" @click="indexType = 1"><a href="#">首页</a></li>
            <li :class="indexType == 2 ? 'liTab' : 'liTabHoure'" @click="indexType = 2"><a href="#">公司简介</a></li>
            <li :class="indexType == 3 ? 'liTab' : 'liTabHoure'" @click="indexType = 3"><a href="#">产品展示</a></li>
            <li :class="indexType == 4 ? 'liTab' : 'liTabHoure'" @click="indexType = 4"><a href="#">联系我们</a></li>
          </ul>
        </nav>

     </div>
<!-- 首页数据 -->
 <homePage v-if="indexType === 1"></homePage>

 <!-- 公司简介 -->
<intro v-if="indexType === 2"></intro>


<!-- 产品展示 -->
<productList v-if="indexType === 3"></productList>

<!-- 联系我们 -->

<ContactUs v-if="indexType === 4"></ContactUs>

  <newPageFooter></newPageFooter>
  </div>
</template>

<script>
import ContactUs from './supplier/ContactUs.vue';

import homePage from './supplier/homePage.vue';
import intro from './supplier/intro.vue';
import productList from './supplier/productList.vue';

import newPageFooter from '../../../components/page/engineering5188/new-page-footer.vue';
import { mapState } from 'vuex';
import {openBaiduMap} from "../../../util/map"

export default{
  name:"supplierHome",
  components:{
    newPageFooter,
    homePage,
    intro,
    ContactUs,
    productList
  },

  computed: {
    ...mapState([
      "userInfo",
    ]),
  },
  data() {
      return {
        keyword:'',
        shopInfo:{},
        indexType:1,
        logoSrc: 'https://example.com/company-logo.png', // 公司logo图片地址
        mainPushLabelSrc: 'https://example.com/main-push-label.png', // 店铺主推标签图片地址
        imageSrc1: 'https://example.com/ship1.jpg', // 主推商品1图片地址
        imageSrc2: 'https://example.com/ship2.jpg', // 主推商品2图片地址
        imageSrc3: 'https://example.com/ship3.jpg', // 主推商品3图片地址
        imageSrc4: 'https://example.com/ship4.jpg', // 主推商品4图片地址
        rating: 4.5,
        products: [
          {
            image: 'https://example.com/product1.jpg',
            name: '商品名称文字占位商品名称文字占位',
            price: 3256
          },
          {
            image: 'https://example.com/product1.jpg',
            name: '商品名称文字占位商品名称文字占位非官方大哥fjasjfoaisjfoiasjfoia',
            price: 3256
          },
          {
            image: 'https://example.com/product1.jpg',
            name: '商品名称文字占位商品名称文字占位',
            price: 3256
          },
          {
            image: 'https://example.com/product1.jpg',
            name: '商品名称文字占位商品名称文字占位',
            price: 3256
          },
          {
            image: 'https://example.com/product2.jpg',
            name: '商品名称文字占位商品名称文字占位',
            price: 3256
          },
          {
            image: 'https://example.com/product3.jpg',
            name: '商品名称文字占位商品名称文字占位',
            price: 3256
          },
          // 更多商品数据...
        ]
      };
    },
    created() {
      if(this.$route.query.shop_id){
        this.shop_id = this.$route.query.shop_id 
      } else {
        this.shop_id = this.userInfo.id
      }
      this.getData(); 
    },
    methods: {
      openMap(reg_address){
      openBaiduMap(reg_address);
    },
      jumpSearch(){
        this.$router.push({
            path: '/haishiSearchResult',
            query: { keyword: this.keyword, tabshow:1 }
          })
      },
      getData(){
        this.$httpApi("/api/shopIndex", {
          shop_id:this.shop_id 
        },'get').then(res=>{
          this.shopInfo = res.data.shop;
          console.log(res)
        })
      } 
    }

}
</script>

<style scoped lang="less">
.lookDt{

font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 14px;
color: #2F9CFB;
text-align: left;
font-style: normal;
text-decoration-line: underline;
text-transform: none;
padding-left: 25px;
}
.weizhiIcon{
  width: 12px;
  height: 16px;
  margin-right: 5px;
}

.page{
  .lineShow{
    width: 48px;
height: 3px;
background: #FFFFFF;
border-radius: 3px 3px 3px 3px;
}


  .navHeard{
    width: 100%;
   height: 58px;
   line-height: 58px;
background: #0052D9;
border-radius: 0px 0px 0px 0px;
  }
  .dizhi{

font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 14px;
color: #858792;
text-align: left;
font-style: normal;
text-transform: none;
  }
  /* 顶部导航栏样式 */
  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    color: white;
    height: 96px;
  }

  .headerDiv{
    width: 1530px;margin: auto;display: flex;justify-content: space-between;
  }



  .logo-wrapper {
    height: 100%;
    display: flex;
    align-items: center;
  }
  .logo {
    width: 60px;
    height: 60px;
    text-align: left;
    margin-right: 36px;
  }

  .zhtyText{
   
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 14px;
color: #6D6D6D;
text-align: left;
font-style: normal;
text-transform: none;
  }
.dizhiDiv{
  margin-top: 12px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 14px;
color: #858792;
text-align: left;

font-style: normal;
text-transform: none;
}
.strengthIcon{
 margin-right: 20px;
}
.strengthIcon img{
  width: 78px;
  height: 20px;
}
  
  .company-name {

font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 18px;
color: #000000;
line-height: 22px;
text-align: left;
font-style: normal;
text-transform: none;
margin-right: 20px;
  }
 
  .nav{
    width: 1530px;
    margin: auto;
    height: 68px;
  }

  .nav ul {
   
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .liTab{
    border-bottom: 3px solid #fff;
    margin-right: 115px;
    height: 57px;
    padding: 0 5px;

font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 16px;
color: #FFFFFF;

font-style: normal;
text-transform: none;
  }

  .liTabHoure {
    
    margin-right: 115px;
    height: 57px;
    padding: 0 5px;

font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 16px;
color: #FFFFFF;

font-style: normal;
text-transform: none;
  }


  
  .nav a {
    color: white;
    text-decoration: none;
  }
  .search-wrapper {
    display: flex;
  }
  .search-input {
    width: 501px;
height: 52px;
background: #FFFFFF;
border-radius: 6px 0px 0px 6px;
border: 2px solid #FF6F00;
padding: 16px;
font-size: 14px;
color: #333333;
  }
  .search-button {
    width: 118px;
height: 52px;
background: linear-gradient( 90deg, #FF7E00 0%, #FF6A00 100%);
border-radius: 0px 6px 6px 0px;
font-family: Arial, Arial;
font-weight: bold;
font-size: 16px;
color: #FFFFFF;

font-style: normal;
text-transform: none;
  }
  
  /* 主内容区域样式 */
  .main {
    padding: 20px;
  }
  .main-push {
    display: flex;
    margin-bottom: 20px;
  }
  .main-push-label {
    width: 100px;
  }
  .main-push-images {
    display: flex;
    background-color: #28a745;
  }
  .main-push-img {
    width: 222px;
    height: 162px;
   
  }
  .company-info-right {
    width: 300px;
    background-color: #f4f4f4;
    padding: 10px;
  }
  .tag {
    background-color: #28a745;
    color: white;
    padding: 2px 6px;
    border-radius: 2px;
    margin-right: 5px;
  }
  .address {
    margin-top: 5px;
  }
  .contact-buttons {
    margin-top: 10px;
    display: flex;
    gap: 10px;
  }
  .call-button,
  .chat-button {
    padding: 8px 15px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
  }
  .call-button {
    background-color: #007bff;
    color: white;
  }
  .chat-button {
    background-color: #17a2b8;
    color: white;
  }
  
  /* 精选商品区域样式 */
  .selected-products {
    margin-bottom: 20px;
    background-color: #fff;
    padding: 18px 30px;
  }
  .section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
  }
  .product-count {
 
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 14px;
color: #333333;
text-align: right;
font-style: normal;
text-transform: none;
  }
  .product-list {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
  }
  .product-item {
    width: 336px;
    height: 334px;
    border: 1px solid #e0e0e0;
   
    /* text-align: center; */
  }
  .product-img {
    width: 100%;
    height: auto;
    margin-bottom: 10px;
  }
  .product-price {
font-family: Arial, Arial;
font-weight: 400;
font-size: 14px;
color: #333333;
font-style: normal;
text-transform: none;
    margin-bottom: 12px;
    padding-left: 16px;
  }
  .product-name {
    width: 297px;
height: 22px;
font-family: PingFang SC, PingFang SC;
font-weight: bold;
font-size: 16px;
color: #000000;

font-style: normal;
text-transform: none;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-left: 16px;
  }
}




</style>